<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <meta http-equiv="Pragma" content="no-cache"/>
    <meta http-equiv="no-cache"/>
    <meta http-equiv="Expires" content="-1"/>
    <meta http-equiv="Cache-Control" content="no-cache"/>
    <title>编辑驳回原因</title>

    <script type="text/javascript">
      Ext.onReady(function(){
        Ext.QuickTips.init();


        var rejectId = <%= params[:id] %>;
        var editRejectForm=new Ext.form.FormPanel({
          width:300,
          //labelAlign: 'top',
          url:'/reject/update?id='+rejectId,
          buttonAlign:'center',
          autoHeight:true,
          fileUpload: true,
          bodyStyle: 'padding:5px',
          labelWidth:100,
          waitMsgTarget: true,
          frame: true,
          reader:new Ext.data.JsonReader({
          },[
            {name:'id'},
            {name:'reson'},

          ]
        ),
          items:[{
              xtype:'textfield',
              fieldLabel: '驳回原因',
              name: 'reson',
              allowBlank:false,
              anchor:'90%'
            }],
          buttons:[{
              text:'确定',
              handler: function(){
                this.setDisabled(true);
                if (editRejectForm.form.isValid()) {
                  editRejectForm.form.submit({
                    method: 'post',
                    waitMsg: '正在保存信息...',
                    success: function(result, response){
                      if (response.result.info == "success") {
                        //添加成功后，隐藏窗口，并刷新Grid
                        editRejectWin.destroy();
                      }
                      else {
                        Ext.MessageBox.alert('消息', response.result.info);
                         this.setDisabled(false);
                      }
                    },
                    failure: function(result, response){
                      Ext.MessageBox.alert('提示', result.responseText);
                      this.setDisabled(false);
                    }
                  });
                }
                else {
                  Ext.MessageBox.alert('错误提示', '请按要求填写必输选项.');
                  this.setDisabled(false);
                }
              }
            },{
              text:'取消',
              handler:function(){
                editRejectWin.destroy();
              }
            }]
        });
        editRejectForm.form.load({
          url: '/reject/edit?id=' + rejectId,
          success: function(form, action){
          },
          failure: function(form, action){
            Ext.MessageBox.alert('提示信息', '信息加载失败');
          }
        });
        editRejectForm.render('edit_reject_form');
      })
    </script>
  </head>
  <body>
    <div id="edit_reject_form"></div>
  </body>
</html>
